<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_advpara.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ti_advpara ti_advpara = new Ti_advpara();
	String _pos_name = "",adv_type="";
	
		String g_cust_id = "";	
	if( session.getAttribute("session_cust_id") != null ){
		g_cust_id = session.getAttribute("session_cust_id").toString();
		ti_advpara.setCust_id(g_cust_id);
	}
	
	if(request.getParameter("n_pos_name")!=null && !request.getParameter("n_pos_name").equals("")){
		_pos_name = request.getParameter("n_pos_name");
		ti_advpara.setPos_name(_pos_name);
	}
	
		if(request.getParameter("adv_type")!=null && !request.getParameter("adv_type").equals("")){
		adv_type = request.getParameter("adv_type");
		ti_advpara.setAdv_type(adv_type);
	}
	Ti_advparaInfo ti_advparaInfo = new Ti_advparaInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_advparaInfo.getListByPage(ti_advpara,Integer.parseInt(iStart),limit);
	int counter = ti_advparaInfo.getCountByObj(ti_advpara);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?pos_name="+_pos_name+"&adv_type="+adv_type+"&iStart=",Integer.parseInt(iStart),limit);
	String para =	"n_pos_name="+_pos_name+"&adv_type="+adv_type+"&iStart="+Integer.parseInt(iStart)+"&limit="+limit;
	//out.print(para);
%>
<html>
  <head>
    
    <title>广告位管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script language="javascript" type="text/javascript" src="js_advpara.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>广告位管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				广告位名称:<input name="n_pos_name" type="text" maxLength="50" /> 
				广告位类型:<select name="adv_type" id="adv_type" style="width:130px;">
							<option value="">请选择</option>
							<option value=0>文字</option><option value=1>图片</option><option value=2>图文</option>
				</select> 
				
				
				<input name="searchInfo" type="button" value="搜索" onclick="searchForm()"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe" >
		<tr><td align="center" bgcolor="#ECE6E6"><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_bg" border="0" >
		<tr>
			<td  width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			
				<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			
			
			<td >
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>广告位名称</th>
		  	
		  	<th width="12%">广告位id</th>
		  	
		  	<th width="12%">广告类型</th>
		  	
		  	<th width="8%">状态</th>
		  	
			  <th width="10%">价格</th>
			  	
		  	<th width="15%">录入时间</th>
		  	<th width="5%">修改</th>
	  		<th width="5%">删除</th>
		</tr>
		
		
		<% 
					
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		String pos_id="",cust_id="",_adv_type="",pos_name="",content="",pos_num="",word_num="",price="",page_url="",no_show="",state_code="",user_id="",in_date="",remark="";
		String _adv_typeSe="";
		
		if(map.get("pos_id")!=null) pos_id = map.get("pos_id").toString();
  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	if(map.get("adv_type")!=null) {_adv_type = map.get("adv_type").toString();}
  	
  	if(map.get("adv_type")!=null) {_adv_typeSe = map.get("adv_type").toString();}
  	
  	if(map.get("pos_name")!=null) pos_name = map.get("pos_name").toString();
  	if(map.get("content")!=null) content = map.get("content").toString();
  	if(map.get("pos_num")!=null) pos_num = map.get("pos_num").toString();
  	if(map.get("word_num")!=null) word_num = map.get("word_num").toString();
  	if(map.get("price")!=null) price = map.get("price").toString();
  	if(map.get("page_url")!=null) page_url = map.get("page_url").toString();
  	if(map.get("no_show")!=null) no_show = map.get("no_show").toString();
  	if(map.get("state_code")!=null) state_code = map.get("state_code").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
		if(in_date.length()>19)in_date=in_date.substring(0,19);
  	if(map.get("remark")!=null) remark = map.get("remark").toString();
  	
 		 if(_adv_type.equals("0")){_adv_type="文字";}else if(_adv_type.equals("1")){_adv_type="图片";}else if(_adv_type.equals("2")){_adv_type="图文";}
  	 	if(state_code.equals("0")){state_code="启用";}else if(state_code.equals("1")){state_code="禁用";}
		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=pos_id %>" /></td>
			
			 	<td><a href="updateInfo.jsp?pos_id=<%=pos_id %>&<%=para%>"><%=pos_name%></a></td>
			
			  <td width="12%"><%=pos_id%></td>
			
		  	<td width="12%"><a href="index.jsp?adv_type=<%=_adv_typeSe%>"><%=_adv_type%></a></td>
		  	
		  	<td width="8%"><%=state_code%></td>
			
			<td width="10%"><%if(!price.equals("")){out.println(price);}else{out.println("0");}%>元/天</td>
			
			<td width="15%"><%=in_date%></td>
					
			<td width="5%"><a href="updateInfo.jsp?pos_id=<%=pos_id %>&<%=para%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  	<td width="5%"><a href="javascript:delOneNews('<%=pos_id%>');"><img border="0" src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" class="tablehe" cellspacing="0" border="0">
		<tr><td align="center" bgcolor="#ECE6E6"><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	   <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	   <input type="hidden" name="pkid" id="pkid" value="" />
	  
	 	 <input type="hidden" name="pos_id" id="pos_id" value="" /> 
	   <input type="hidden" name="state_code" id="state_code" value="" />
	 	 <input type="hidden" name="bpm_id" id="bpm_id" value="3084" />
	  </form>
</body>

</html>
